/******************************************************************
 *
 *    tenant, Powered By uyun.cn.
 *
 *    Copyright (c) 2001-2020
 *    https://uyun.cn
 *
 *    Package:     wzg.com.alternate
 *
 *    Filename:    PrintThread
 *
 *    Description: (用一句话描述该文件做什么)
 *
 *    Copyright:   Copyright (c) 2001-2020
 *
 *    Company:     uyun.cn
 *
 *    @author: 王志刚
 *
 *    @version: 1.0.0
 *
 *    Create at:   2018-01-04 下午5:28
 *
 *    Revision:
 *
 *    2018-01-04 下午5:28
 *        - first revision
 *
 *****************************************************************/
package wzg.com.alternate;

/**
 * PrintThread(这里用一句话描述这个类的作用)
 *
 * @author wangzg
 * @version 1.0.0
 * @create 2018-01-04 下午5:28
 */
public class PrintThread extends Thread{
    private String para;
    private String name;

    public PrintThread(String para,String name) {
        this.para = para;
        this.name = name;
    }

    @Override
    public void run() {
        while (true){
            synchronized (para){
                try {

                    System.out.println(name);
                    para.notify();
                    para.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}
